#pragma once

#include "Framework/EditorViewModelSubsystem.h"
#include "Framework/SubsystemManager.h"
#include "Containers/ScriptDelegateImplement.h"
#include "ProjectViewModel.m.h"

RCLASS()
class RProjectViewModel : public REditorViewModelSubsystem    
{
    ROBJECT

public:
    static RProjectViewModel* Get();
    static bool IsInitialized();
    virtual void Initialize() override;
    virtual void Deinitialize() override;


    virtual void FirstTimeInitializeObject();

    void NotifyProjectOpened();
    void NotifyProjectClosed();

    RFIELD()
    TScriptDelegate<void()>  OnProjectOpened;
    RFIELD()
    TScriptDelegate<void()>  OnProjectClosed;

    template<typename SubsystemType>
    TSharedObjectPtr<SubsystemType> GetSubsystem()
    {
        return SubsystemManager->GetSubsystem<SubsystemType>();
    }

protected:
    RFIELD()
    TSharedObjectPtr<RSubsystemManager> SubsystemManager;
    
};